<?php
    function argErr($status=false,$detail="请输入完成参数"){
        $msg=array();
        $msg["status"]=$status;
        $msg["detail"]=$detail;
        exit(json_encode($msg));
    }


    function isExist($key){
        $val = $_GET[$key];
        if(!($val)){
            argErr();
        }
        global $conn;
        $msg=array("user"=>"用户名","phone"=>"手机号");
        $search="select * from `regi` where $key='$val'";

        $result= mysqli_query($conn,$search);

        $item=mysqli_fetch_assoc($result);

        $obj=array();
        if($item){
            $obj["status"]=false;
            $obj["detail"]="该手机号码已是会员";
        }else{
            $obj["status"]=true;
            $obj["detail"]="";

        }
        echo json_encode($obj);
    }
?>